package com.gite.nouette.admin.implementation.model;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import com.gite.nouette.admin.contract.model.IModule;
import com.gite.nouette.admin.contract.model.command.ICommandModule;
import com.gite.nouette.admin.contract.service.IServiceASync;

public abstract class AbstractModule extends AbstractModel implements IModule {
	private List<ICommandModule> headerCommands;
	private IServiceASync serviceASync;

	public AbstractModule() {
		setHeaderCommands(new ArrayList<ICommandModule>());
	}

	public AbstractModule(ICommandModule... headerCommands) {
		setHeaderCommands(headerCommands);
	}

	@Override
	public List<ICommandModule> getHeaderCommands() {
		return this.headerCommands;
	}

	@Override
	public void setHeaderCommands(List<ICommandModule> headerCommands) {
		this.headerCommands = headerCommands;
	}

	public boolean addHeaderCommand(ICommandModule command) {
		return getHeaderCommands().add(command);
	}

	public void setHeaderCommands(ICommandModule... commands) {
		setHeaderCommands(Arrays.asList(commands));
	}

	@Override
	public IServiceASync getServiceASync() {
		return serviceASync;
	}

	@Override
	public void setServiceASync(IServiceASync serviceASync) {
		this.serviceASync = serviceASync;
	}

}
